AddCSLuaFile( "shared.lua" )  
 
include('shared.lua')

function ENT:Initialize()
	
	if (self.WeaponModel == nil || self.WeaponClass == nil) then
		Msg("GREENRP: Entity 'weapon_dropped' spawned with WeaponModel or Weapon nil, deleting it!")
	else
		self:SetModel(self.WeaponModel)
	end
	
	self:PhysicsInit( SOLID_VPHYSICS )     
	self:SetMoveType( MOVETYPE_VPHYSICS )   
	self:SetSolid( SOLID_VPHYSICS )
 
    local phys = self:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
	end
end

function ENT:Use( activator, caller )
	if ( activator:IsPlayer() ) then //Prepreci lua napake, ce predmet uporabi kar koli drugega kot igralec
		activator:Inventory_AddWeapon(self.WeaponClass)
		self:Remove()
	end
end